package com.shop.front.dao.pay;

import com.shop.jpa.BaseDao;
import com.shop.domain.pay.PayDetail;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * <p>数据操作HQL</p>
 * <p>Table: pay_detail - 支付明细表</p>
 *
 * @author generator
 * @date 2018-09-22 05:00:27
 */
public interface PayDetailDao extends BaseDao<PayDetail, Integer> {

    @Query("from PayDetail where payNo = ?1")
    public PayDetail findByPayNo(String payNo);


    @Modifying(clearAutomatically = true)
    @Query("update PayDetail set completedTime = now(), status = ?2, callbackArgs = ?3 where payNo = ?1 and status in (0, -2)")
    public int updateStatusByPayNo(String payNo, int status, String callbackArgs);
}